package com.example.administrator.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.TextView;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.textMsg)
    TextView mTxtMsg;

    @BindView(R.id.button)
    Button mBtnClick;

    @Inject
    CoffeeMachine coffeeMachine;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(MainActivity.this);
    }

    @OnClick({R.id.button})
    public void testOnClick(Button button) {

        mTxtMsg.setText("making...");
        if (coffeeMachine == null) {
            mTxtMsg.setText("coffeeMachine is not ready.");
        } else {
            mTxtMsg.setText(coffeeMachine.makeCoffee());
        }

    }
}
